package org.example.common.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 分页参数.
 *
 * @author dingcan
 * @since 2022-10-19
 */
@ApiModel("分页参数")
@Data
public class PageParam implements Serializable {
    
    private static final Integer PAGE_NO = 1;
    private static final Integer PAGE_SIZE = 10;
    private static final long serialVersionUID = 7967275230849110260L;
    
    @ApiModelProperty(value = "页码，从 1 开始,默认值为1", required = true, example = "1")
    @NotNull(message = "页码不能为空")
    @Min(value = 1, message = "页码最小值为 1")
    private Integer pageNum = PAGE_NO;
    
    @ApiModelProperty(value = "每页条数，最大值为 100,默认值为10", required = true, example = "10")
    @NotNull(message = "每页条数不能为空")
    @Min(value = 1, message = "页码最小值为 1")
    @Max(value = 100, message = "页码最大值为 100")
    private Integer pageSize = PAGE_SIZE;
    
    @ApiModelProperty("关键字")
    private String keyWord;
    
    @ApiModelProperty("专题id")
    private String subjectId;
    
}
